<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="./vue2.js"></script>
    </head>
    <body>
        <div id="app">
            <input v-on:click="changeMsg" type="button" value="点击改变">
            <input @click="changeMsg" type="button" value="简写">
            <input @click="changeMsgByArg('heima')" type="button" value="传参">
            <input @click="getEvent($event)" type="button" value="事件对象">
            <a href="http://www.baidu.com" @click.prevent="changeMsg">跳转</a>
            <input @keyup="submit" type="text" name="获取键盘码" id="">
            <h1>{{name}}</h1>
        </div>
        <script>
            var vm = new Vue({
                el: '#app',
                data: {
                    name:"jack"
                },
                methods:{
                    changeMsg(){
                        this.name="1111";
                    },
                    changeMsgByArg(arg){
                        this.name=arg;
                    },
                    getEvent(e){
                        console.log(e);
                    },
                    submit:function(e){
                        console.log(e.keyCode,1000);
                    },
                    submit(e){
                        console.log(e.keyCode,2000);
                    }
                }
            })
        </script>
    </body>
</html> 